ToolStreamWriter

Lets a tool's executor write custom events into the agent's active output stream — the port's equivalent of v6's UIMessageStreamWriter (per historical parity gap #21). Distinct from the streamingTool mechanism (which surfaces progress as ToolResult(preliminary = true)): the writer pushes ARBITRARY StreamEvents — e.g. a transient status line (StreamEvent.TextDelta) or a custom data payload (StreamEvent.Raw via writeData) — that don't have to be tool-result-shaped. Writes interleave with the tool's own emissions in stream order. streamToUiMessages ignores Raw by default, so a consumer that wants custom data intercepts the Flow<StreamEvent> before UI conversion.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun write(event: StreamEvent)

Emit any event into the agent's output stream.

Link copied to clipboard
abstract suspend fun writeData(value: JsonElement)

Convenience: emit value as a StreamEvent.Raw custom-data chunk.